package com.service;

import java.sql.Date;
import java.util.List;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.dao.AgentDao;
import com.model.Agent;

@Service("agentService")
@Transactional
public class AgentServiceImpl implements AgentService{
	
	@Autowired
	private AgentDao agentDao;
	
public void add(String branch,Agent agent) {
		agentDao.add(branch,agent);		
	}

	public Agent get(Integer id) {
		return agentDao.get(id);
	}

	public void delete(Integer id) {
		agentDao.delete(id);

	}

	public List<Agent> getByDate(Date from,Date to)
	{
		return agentDao.getByDate(from, to);
	}


	public List<Agent> getAll(int page) {
		return agentDao.getAll(page);

	}

	public int getNoOfRecords() {
		return agentDao.getNoOfRecords();
	}

	@SuppressWarnings("rawtypes")
	@Override
	public List getAgentName() {
			return agentDao.getAgentName();
	}

	@Override
	public List<Agent> getAllForUser(String name) {
		return agentDao.getAllForUser(name);
	}
	@Override
	public List<Agent> getAllForAdmin() {
		return agentDao.getAllForAdmin();
	}


}
